/*
 * Funny Language - a free style programming language.
 * Copyright (C) 2015 by fanguangping (fanguangping@163.com)
 * string.h
 */

#ifndef FUNNY_STRING_H
#define FUNNY_STRING_H

#include <ctype.h>

typedef char* String;

#define IS_SPACE(c)  (isascii(c) && isspace(c))

String alloc_string(int size);
String *alloc_string_array(int size);
String realloc_string(String str, int size);

String init_string();
String copy_string(String str);
int is_blank_string(String str);
String trim_string(String str);
String inner_string(String str);
String substr_before(String str, char c);
String substr_between(String str, char a, char b);
String substr_after(String str, char c);
String dyna_strcat(String str, String append);
String append_char(String str, char c);
String* split_string(String string, const char delimiter);
String* split_strings(String string, const char* delimiter);
String* split_string_once(String string, const char delimiter);
String* split_string_with_escape(String string, const char delimiter, const char escape);
String* fetch_string_from_paren_with_escape(String string, const char open, const char close, const char escape);
int equals_string(void *a, void *b);
int hash_code_string(void *key);
String strlwr(String str);
char *string_replace(char *orig, char *rep, char *with);
String append_path(String path, String append);
int has_suffix(String string, String suffix);
String change_suffix(String string, String oldSuffix, String newSuffix);
String extract_string(String s);

#endif //FUNNY_STRING_H
